package nomo.controller;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import nomo.dao.ICategoryDao;
import nomo.model.Category;

@RestController
@RequestMapping("category")
public class CategoryController {
	@Resource
	private ICategoryDao category;
	
	@RequestMapping("/findAll.do")
	@ResponseBody
	public Map findAll() {
		Map map=new HashMap();
		map.put("code", "0");
		map.put("msg", "");
		map.put("count","100");
		map.put("data",category.findAll());
		return map;
		
	}
	
	@RequestMapping("/del.do")
	@ResponseBody
	public int del(Integer id) {
		return category.del(id);
		
	}
	
	@RequestMapping("/add.do")
	@ResponseBody
	public int add(Category c) {
		return category.add(c);
		
	}
	
	@RequestMapping("/add2.do")
	@ResponseBody
	public int add2(String name) {
		return category.add2(name);
		
	}
	
	
	

}
